package com.example.memohehang.controller;

import com.example.memohehang.common.R;
import com.example.memohehang.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@Controller
@RequestMapping("/type")
public class TypeController
{
    @Autowired
    private TypeService typeService;

    // 获取编号与类型的映射表
    @ResponseBody
    @GetMapping("/getMapping")
    public ResponseEntity<R> typeMapping()
    {

        HttpHeaders headers = new HttpHeaders();
        headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
        headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "*");
        R r = typeService.typeMapping();
        return ResponseEntity.ok()
                .headers(headers)
                .body(r);
    }

}

